package control;

import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;

public class Util {

	private static int iX;
	private static int iY;
	private static int iWidth;
	private static int iHeight;

	private Util() {

	}

	public static void centerFrame(Shell shell) {

		Monitor primary = shell.getDisplay().getPrimaryMonitor();

		iHeight = primary.getClientArea().height;
		iWidth = primary.getClientArea().width;
		iX = (iWidth / 2) - (shell.getBounds().width / 2);
		iY = (iHeight / 2) - (shell.getBounds().height / 2);

		shell.setLocation(iX, iY);
	}

	public static boolean validateInput(String text) {
		if (text.trim().isEmpty() || text == null) {
			return false;
		}
		return true;

	}

}
